<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="../master.html" />

<?python
    from mnemoply.mass_actions import registry
    from mnemoply.controllers.MassActions import make_mass_action_url
    from mnemoply.widgets import FieldGroup, column_parms
    from mnemoply.utils import gen_random_id
?>

<head>
    <title><span py:strip="True">${obj.model_title}</span>: &laquo;${obj.title}&raquo;</title>
</head>

<body>

    <div id="show" style="display: block;">
        <center>
            <h3>
                <span>${obj.model_title}</span>:
                &laquo;<span>${obj.title}</span>&raquo;
                <a py:if="is_editable" href="#" onclick="toggleDisplay('edit'); toggleDisplay('show'); return false; ">
                    <img src="/static/images/edit.png" alt="Edit" border="0" hspace="0" />
                </a>
            </h3>
        </center>


        <div class="tabber">

            <div class="tabbertab">
                <h2>Properties</h2>

                <span py:def="display_fieldlist(field_list)">
                    <table border="0" cellspacing="0" cellpadding="2">
                        <tr py:for="field in field_list">
                            <?python
                                name = field
                                value, column = values[name]
                                title = column.title
                            ?>
                            <th>
                                <label class="fieldlabel" for="${name}" py:content="title" />
                            </th>
                            <td>${value} </td>
                        </tr>
                    </table>
                </span>

                <span py:for="field_group in view_fields">
                    <?python display_title = hasattr(field_group, 'title') and field_group.title ?>

                    <span py:if="display_title">
                        <?python
                            hide = getattr(field_group, 'hide', False)
                            random_id = gen_random_id()
                        ?>

                        <span py:if="hide">
                            <hr />

                            <center><i><b>
                                <a href="#"
                                    onclick="toggleDisplay(${random_id}); return false; "
                                    py:content="field_group.title" />
                            </b></i></center>

                            <div id="${random_id}" style="display: none;">${display_fieldlist(field_group.fields)}</div>
                        </span>

                        <span py:if="not hide">
                            <hr />

                            <center>
                                <i><b py:content="field_group.title" /></i>
                            </center>

                            <span>${display_fieldlist(field_group.fields)}</span>
                        </span>
                    </span>

                    <span py:if="not display_title">${display_fieldlist(field_group.fields)}</span>
                </span>
            </div>
            <!--# TODO-->
            <div class="tabbertab" py:for="tab in tabs">
                <h2 py:content="tab.title" />
                <?python
                    #TODO
                    (ma_class_name, name) = tab.display()
                ?>
                <xi:include href="${tab.template}.html" />
            </div>
        </div>


    </div>



    <div id='edit' style="display: none;">
        <center>
            <h3 py:if="action == 'edit'">
                <span>Editing</span> <span>${model_object.model_title}</span>: &laquo;<span>${obj.title}</span>&raquo;
                <a href="#" onclick="toggleDisplay('edit'); toggleDisplay('show'); return false; ">
                    <img src="/static/images/icon_eye.gif" alt="View" border="0" hspace="0" />
                </a>
            </h3>

        </center>

        <span>${ET(tg.back_widget())}</span>

        <span>${ET(form.display(fields, action=action, submit_text=action_text))}</span>
    </div>


</body>
</html>
